<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2020/2/20
  Time: 13:57
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>JSTL示例</title>
</head>
<body>
<%
    List<String> list = new ArrayList<String>();
    list.add("A");
    list.add("B");
    list.add("C");
    list.add("D");
    list.add("E");
    list.add("F");

    request.setAttribute("list", list);
%>
迭代值：<br>
<c:forEach var="emle" items="${list}" begin="1" end="5" step="2" varStatus="status">
    第${status.count}次迭代,索引:${status.index},值是:${emle}<br>
</c:forEach>
指定迭代次数：<br>
<c:forEach var="emle"  begin="1" end="5"  varStatus="status">
    第${status.count}次迭代,索引:${status.index}<br>
</c:forEach>

</body>
</html>
